export default {
    namespaced: true,
    state: {
        colors: [
            {name: '蓝色主体', color: '#134857'},
            {name: '绿色主体', color: '#497568'},
            {name: '黑色主体', color: '#000000'},
            {name: '灰色主体', color: '#545c64'},
        ],
        // 当前主体
        currentColor: {
            name: '蓝色主体', color: '#134857'
        }
    },
    getters: {
        // 遍历字体数组
        getColorName(state) {
            return state.colors.map(val => val.name)
        }
    },
    mutations: {
        // 改变当前颜色
        updateCurrentColor(state, value) {
           state.currentColor=value
        }
    },
    actions: {
        updateCurrentColor(store,value){
            store.commit('updateCurrentColor',value)
        }
    }
}
